package vfrpt

class ProductionYieldByMController {

    def dynamicQueryService

    def productionYieldByM() {
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 100
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def tableHeadList = []
        def productionYieldByM = []
        def pageSizeList = [10, 20, 50, 100]
        def totalCount = 0
        if (params.EXPORT_CONTENT_NAME == 'Excel') {
            params.SYS_QUERY_NAME = 'productionYieldByM'
            productionYieldByM = dynamicQueryService.queryForList(params)
            if (productionYieldByM.size() > 0) {
                tableHeadList = productionYieldByM[0].keySet()
            }
            params.SYS_QUERY_NAME = 'productionYieldByMCount'
            totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        }
        [
                startno           : params.startno ?: '',
                endno             : params.endno ?: '',
                pageSize          : pageSize,
                totalCount        : totalCount,
                pageSizeList      : pageSizeList,
                tableHeadList     : tableHeadList,
                productionYieldByM: productionYieldByM,
                startTime         : params.startTime ?: '',
                endTime           : params.endTime ?: ''
        ]
    }
}
